﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin.master" AutoEventWireup="true"
    CodeFile="ManageAccount.aspx.cs" Inherits="ManageAccount" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <div class="post">
       <%if (Request.Cookies["username"] == null || Request.Cookies["LoaiTK"]==null || Request.Cookies["LoaiTK"].Value != "1")
          { %>
           <asp:Label ID="Label3" runat="server" Text="Acess is denied !"></asp:Label>
           <%} %>
            
        <% if (Request.Cookies["LoaiTK"].Value == "1")
           {%>
            
        <asp:Label ID="Label1" runat="server" Text="<%$Resources:Resource,accountstatus %>"></asp:Label>
        <table style="width: 100%">
            <tr>
                <td colspan="2" style="font-weight: 700; color: #FFFFFF; text-align: center; background-color: #0066FF;
                    font-size: large">
                    <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Resource, accinfo%>" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="font-size: x-small">
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="TenDangNhap"
                        DataSourceID="SqlDataSource1" Width="100%" BackColor="White" BorderColor="White"
                        BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None"
                        AllowPaging="True">
                        <Columns>
                            <asp:CommandField ShowDeleteButton="True" />
                            <asp:BoundField DataField="TenDangNhap" HeaderText="TenDangNhap" ReadOnly="True"
                                SortExpression="TenDangNhap" />
                            <asp:BoundField DataField="MatKhau" HeaderText="MatKhau" SortExpression="MatKhau" />
                            <asp:BoundField DataField="LoaiTK" HeaderText="LoaiTK" SortExpression="LoaiTK" />
                            <asp:BoundField DataField="HoTen" HeaderText="HoTen" SortExpression="HoTen" />
                            <asp:BoundField DataField="DiaChi" HeaderText="DiaChi" SortExpression="DiaChi" />
                            <asp:BoundField DataField="DienThoai" HeaderText="DienThoai" SortExpression="DienThoai" />
                            <asp:BoundField DataField="MaTheThanhToan" HeaderText="MaTheThanhToan" SortExpression="MaTheThanhToan" />
                        </Columns>
                        <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
                        <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                        <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                        <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                        <SortedAscendingCellStyle BackColor="#F1F1F1" />
                        <SortedAscendingHeaderStyle BackColor="#594B9C" />
                        <SortedDescendingCellStyle BackColor="#CAC9C9" />
                        <SortedDescendingHeaderStyle BackColor="#33276A" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                        DeleteCommand="DELETE FROM [ThanhVien] WHERE [TenDangNhap] = @original_TenDangNhap"
                        InsertCommand="INSERT INTO [ThanhVien] ([TenDangNhap], [MatKhau], [LoaiTK], [HoTen], [DiaChi], [DienThoai], [MaTheThanhToan]) VALUES (@TenDangNhap, @MatKhau, @LoaiTK, @HoTen, @DiaChi, @DienThoai, @MaTheThanhToan)"
                        OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [ThanhVien]"
                        UpdateCommand="UPDATE [ThanhVien] SET [MatKhau] = @MatKhau, [LoaiTK] = @LoaiTK, [HoTen] = @HoTen, [DiaChi] = @DiaChi, [DienThoai] = @DienThoai, [MaTheThanhToan] = @MaTheThanhToan WHERE [TenDangNhap] = @original_TenDangNhap">
                        <DeleteParameters>
                            <asp:Parameter Name="original_TenDangNhap" Type="String" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="TenDangNhap" Type="String" />
                            <asp:Parameter Name="MatKhau" Type="String" />
                            <asp:Parameter Name="LoaiTK" Type="String" />
                            <asp:Parameter Name="HoTen" Type="String" />
                            <asp:Parameter Name="DiaChi" Type="String" />
                            <asp:Parameter Name="DienThoai" Type="String" />
                            <asp:Parameter Name="MaTheThanhToan" Type="String" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="MatKhau" Type="String" />
                            <asp:Parameter Name="LoaiTK" Type="String" />
                            <asp:Parameter Name="HoTen" Type="String" />
                            <asp:Parameter Name="DiaChi" Type="String" />
                            <asp:Parameter Name="DienThoai" Type="String" />
                            <asp:Parameter Name="MaTheThanhToan" Type="String" />
                            <asp:Parameter Name="original_TenDangNhap" Type="String" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
        </table>
        <%}%>
          
    </div>
</asp:Content>
